package com.colin.aiyi.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.colin.aiyi.fragment.PlaceholderFragment;

/**
 * Created by hl on 2017/5/3.
 */

public class SectionsPagerAdapter2 extends FragmentPagerAdapter {

    public SectionsPagerAdapter2(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        // getItem is called to instantiate the fragment for the given page.
        // Return a PlaceholderFragment (defined as a static inner class below)


        return PlaceholderFragment.newInstance(position + 1);
    }

    @Override
    public int getCount() {
        // Show 3 total pages.
        return 3;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        switch (position) {
            case 0:
                return "最新";
            case 1:
                return "人气";
            case 2:
                return "已购音频";
            case 3:
                return "一鸣惊人";
        }
        return null;
    }
}